export const arrToTree = (arr, id=0) => {
    const tree = []
    arr.forEach(e => {
        if (e.pid === id) {
            const childrenArr = arrToTree(arr, e.id)
            if (childrenArr.length) e.children = childrenArr
            tree.push(e)
        }
    })
    return tree
}
